Skip to main content

QR Decomposition

QR(input: any[] | Mat) : any[]

param input - The matrix to be decomposed using the QR method. Needs to be a square matrix.

returns: any[] - The matrix Q and R from the decomposition.

This function decomposes a square matrix using the QR method, where Q is an orthogonal matrix and R is an upper triangular matrix. Recall that an orthogonal matrix is one where the rows and columns are orthonormal vectors which is satisfied by Q^TxQ = QxQ^T = I, where I is identity). Knowing when one decomposition is better than the other is key to saving time and being efficient with data.

Note Please use QR and not qr. It is capital case for the time being.